// .txt

beginzonescript;

variables;

short im_hostile = 0;
short last_abil;
short counter = 0;
short set_ter1 = 0;

body;

beginstate INIT_STATE;
	last_abil = get_current_tick();
	sf(14,28,1);
	
	set_strategy(30001,2);
	set_name(30001,"Bony Sniper");
	
	set_name(1406,"Frozen Specter");
	set_boss_level(1406,1);
	set_percent_adjust(1406,6,-30);
	change_max_health(1406,30);
	set_walk_speed(1406,0);

	set_name(30008,"Burning Bones");
	add_ability(30008,10,65,0);
	set_strategy(30008,2);
	change_max_health(30008,40);
	place_particle_num(30008,1075,12,6);
	place_particle_num(30008,1075,13,6);
	
	set_name(30009,"Forge Guardian");
	set_boss_level(30009,1);
	set_attack_range(30009,4);
	
	if (gf(14,14) > 0) { // down done
		erase_char(30001);
		}
		else {
			sf(14,5,0);
			}
	
	if (gf(14,11) > 0) { // up done
		erase_char(30008);
		}
		else {
			sf(14,15,0);
			}
	
//	set_name(,"");

//	set_attack_range(,);

//	add_ability(short which_char_or_group,short which_slot,short which_ability,0);

//	if (is_town_clear(ME))
//		clean_up_town();

	break;

beginstate EXIT_STATE;

break;

beginstate START_STATE;
	//if ((set_ter1 == 0) && (gf(0,0) > 0)) {
	//	set_ter1 = 1;
	//	set_terrain(,,,);
	//	}
		
	// if (gf(,) == 0) {
	//if (get_ran(1,0,100) < 10)
	//	give_char_text_bubble(,"");
	//	}

	//if (gf(,) < 2) {
	//	inc_flag(,,1);
	//	if (gf(,) == 2)
	//		begin_talk_mode();
	//	}

	if ((gf(14,15) == 0) && (gf(14,11) == 0) && (on_which_layer() == 1) && (party_within_dist(31,34,5))) {
		sf(14,15,1);
		sf(14,23,1);
		sf(14,28,0);
		activate_hidden_group(10);
		play_sound(18);
		set_name(30010,"Bony Sniper");
		set_strategy(30010,2);
		begin_talk_mode(19);
		}
	if (((is_combat()) && (tick_difference(last_abil,get_current_tick()) > 0)) || ((is_town()) && (tick_difference(last_abil,get_current_tick()) > 5))) {
		last_abil = get_current_tick();
		if ((gf(14,15) > 0) && (gf(14,15) < 100)) {
			inc_flag(14,15,1);
			if (gf(14,15) == 4) {
				sf(14,24,1);
				activate_hidden_group(11);
				set_name(30011,"Preserved Body");
				play_sound(18);
				print_str("One of the gates opens!");
				}
			if (gf(14,15) == 8) {
				sf(14,25,1);
				activate_hidden_group(12);
				play_sound(18);
				print_str("One of the gates opens!");
				}
			if (gf(14,15) == 12) {
				sf(14,26,1);
				activate_hidden_group(13);
				set_name(30013,"Preserved Scorpion");
				play_sound(18);
				print_str("One of the gates opens!");
				}
			if (gf(14,15) == 15) {
				sf(14,27,1);
				sf(14,28,1);
				sf(14,11,1);
				play_sound(18);
				
				begin_talk_mode(20);
				}
			}
		}
break;

beginstate 10;
break;

beginstate 11;
break;

beginstate 12;
break;

beginstate 13;
break;

//	print_str("");
//	set_terrain_string_range(".",1);
//	set_terrain_string_range("The sign says - .",1);
